package com.sum.common.bean;

import java.util.Objects;

/**
 * 读取参数
 */
public class ReadParams {
    private final String password;
    private final int region;
    private final int startAddress;
    private final int dataLength;

    public ReadParams(String password, int region, int startAddress, int dataLength) {
        this.password = password;
        this.region = region;
        this.startAddress = startAddress;
        this.dataLength = dataLength;
    }

    public String getPassword() { return password; }
    public int getRegion() { return region; }
    public int getStartAddress() { return startAddress; }
    public int getDataLength() { return dataLength; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ReadParams that = (ReadParams) o;
        return region == that.region &&
                startAddress == that.startAddress &&
                dataLength == that.dataLength &&
                Objects.equals(password, that.password);
    }

    @Override
    public int hashCode() {
        return Objects.hash(password, region, startAddress, dataLength);
    }

    @Override
    public String toString() {
        return "ReadParams{" +
                "password='" + password + '\'' +
                ", region=" + region +
                ", startAddress=" + startAddress +
                ", dataLength=" + dataLength +
                '}';
    }
}
